/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Enum.LoaiNguoiDungEnum;
import ch.randelshofer.quaqua.QuaquaManager;
import java.awt.Component;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.apache.log4j.Logger;
import pojo.CuaHang;
import pojo.LoaiNguoiDung;
import pojo.NguoiDung;

/**
 *
 * @author 0
 */
public class MainGUI extends javax.swing.JFrame {

    /**
     * Creates new form NewJFrame
     */
    private static Logger logger = Logger.getLogger(MainGUI.class);
    public static NguoiDung nguoiDung = new NguoiDung(0, new CuaHang(4), new LoaiNguoiDung(5), null, null, null, null, null, null, null, false, null, null);
    //public static NguoiDung nguoiDung=null;

    public MainGUI() throws UnsupportedLookAndFeelException {
        initComponents();
        UIManager.setLookAndFeel(QuaquaManager.getLookAndFeel());
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        SetStatusBar();
        //SetMenu();
        
    }

    private void SetStatusBar() {
        if (nguoiDung != null) {
            lblName.setText(String.format("Username: %s  Loại người dùng: %s", nguoiDung.getUsername(), nguoiDung.getLoaiNguoiDung().getTenLoaiNguoiDung()));
        } else {
            lblName.setText("");
        }
    }

    private void SetMenu() {
        if (nguoiDung == null) {
            mnDangNhap.setVisible(true);
            mnDangXuat.setVisible(false);
            mnThayDoiPassword.setVisible(false);
            mnQuanLyNhanVien.setVisible(false);
            mnQuanLyHoaDon.setVisible(false);
            mnQuanLyPhieuThu.setVisible(false);
            mnThongKe.setVisible(false);
            mnQuanLyPhieuNhapHang.setVisible(false);
            mnQuyDinh.setVisible(false);
            mnQuanLySanPham.setVisible(false);
            mnQuanLyCuaHang.setVisible(false);
            mnQuanLyKhachHang.setVisible(false);
        } else {
            mnDangNhap.setVisible(false);
            mnDangXuat.setVisible(true);
            mnThayDoiPassword.setVisible(true);
            int idLoaiNguoiDung = nguoiDung.getLoaiNguoiDung().getId();
            if (idLoaiNguoiDung == LoaiNguoiDungEnum.Admin.getCode()) {
                mnQuanLyNhanVien.setVisible(true);
                mnQuanLyHoaDon.setVisible(true);
                mnQuanLyPhieuThu.setVisible(true);
                mnThongKe.setVisible(true);
                mnQuanLyPhieuNhapHang.setVisible(true);
                mnQuyDinh.setVisible(true);
                mnQuanLySanPham.setVisible(true);
                mnQuanLyCuaHang.setVisible(true);
                mnQuanLyKhachHang.setVisible(true);
            } else if (idLoaiNguoiDung == LoaiNguoiDungEnum.NhanVienBanHang.getCode()) {
                mnQuanLyNhanVien.setVisible(false);
                mnQuanLyHoaDon.setVisible(true);
                mnQuanLyPhieuThu.setVisible(true);
                mnThongKe.setVisible(true);
                mnQuanLyPhieuNhapHang.setVisible(false);
                mnQuyDinh.setVisible(false);
                mnQuanLySanPham.setVisible(false);
                mnQuanLyCuaHang.setVisible(false);
                mnQuanLyKhachHang.setVisible(true);
            } else if (idLoaiNguoiDung == LoaiNguoiDungEnum.NhanVienNhapHang.getCode()) {
                mnQuanLyNhanVien.setVisible(false);
                mnQuanLyHoaDon.setVisible(false);
                mnQuanLyPhieuThu.setVisible(false);
                mnThongKe.setVisible(true);
                mnQuanLyPhieuNhapHang.setVisible(true);
                mnQuyDinh.setVisible(false);
                mnQuanLySanPham.setVisible(false);
                mnQuanLyCuaHang.setVisible(false);
                mnQuanLyKhachHang.setVisible(false);
            } else if (idLoaiNguoiDung == LoaiNguoiDungEnum.NhanVienQuanLy.getCode()) {
                mnQuanLyNhanVien.setVisible(true);
                mnQuanLyHoaDon.setVisible(true);
                mnQuanLyPhieuThu.setVisible(true);
                mnThongKe.setVisible(true);
                mnQuanLyPhieuNhapHang.setVisible(true);
                mnQuyDinh.setVisible(true);
                mnQuanLySanPham.setVisible(true);
                mnQuanLyCuaHang.setVisible(false);
                mnQuanLyKhachHang.setVisible(true);
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabMain = new org.xnap.commons.gui.CloseableTabbedPane();
        stName = new org.jdesktop.swingx.JXStatusBar();
        lblName = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        mnQuanLyNhanVien = new javax.swing.JMenu();
        mnQuanLyCuaHang = new javax.swing.JMenu();
        mnQuanLyKhachHang = new javax.swing.JMenu();
        mnQuanLySanPham = new javax.swing.JMenu();
        mnDanhSachSanPham = new javax.swing.JMenuItem();
        mnDanhSachSanPhamCuaHang = new javax.swing.JMenuItem();
        mnLoaiSanPham = new javax.swing.JMenuItem();
        mnQuanLyPhieuNhapHang = new javax.swing.JMenu();
        mnQuanLyHoaDon = new javax.swing.JMenu();
        mnQuanLyPhieuThu = new javax.swing.JMenu();
<<<<<<< .mine
        mnQuyDinh = new javax.swing.JMenu();
        mnThayDoiPassword = new javax.swing.JMenu();
=======
        mnThongKe = new javax.swing.JMenu();
        mnThongKeDoanhThu = new javax.swing.JMenuItem();
        mnThongKeTon = new javax.swing.JMenuItem();
        mnThongKeHoaDon = new javax.swing.JMenuItem();
        mnThongKePhieuThu = new javax.swing.JMenuItem();
>>>>>>> .r122
        mnDangNhap = new javax.swing.JMenu();
<<<<<<< .mine
=======
        mnQuyDinh = new javax.swing.JMenu();
        mnThayDoiPassword = new javax.swing.JMenu();
>>>>>>> .r122
        mnDangXuat = new javax.swing.JMenu();
        mnQuanLyKhachHang = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Quản lý chuỗi cửa hàng bán quần áo");

        stName.setLayout(new java.awt.GridLayout(1, 0));
        stName.add(lblName);

        jMenuBar1.setDoubleBuffered(true);

        mnQuanLyNhanVien.setText("Quản lý nhân viên");
        mnQuanLyNhanVien.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyNhanVienMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyNhanVien);

        mnQuanLyCuaHang.setText("Quản lý cửa hàng");
        mnQuanLyCuaHang.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyCuaHangMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyCuaHang);

        mnQuanLyKhachHang.setText("Quản lý khách hàng");
        mnQuanLyKhachHang.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyKhachHangMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyKhachHang);

        mnQuanLySanPham.setText("Quản lý sản phẩm");

        mnDanhSachSanPham.setText("Danh sách sản phẩm");
        mnDanhSachSanPham.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnDanhSachSanPhamActionPerformed(evt);
            }
        });
        mnQuanLySanPham.add(mnDanhSachSanPham);

        mnDanhSachSanPhamCuaHang.setText("Danh sách sản phẩm của cửa hàng");
        mnDanhSachSanPhamCuaHang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnDanhSachSanPhamCuaHangActionPerformed(evt);
            }
        });
        mnQuanLySanPham.add(mnDanhSachSanPhamCuaHang);

        mnLoaiSanPham.setText("Danh sách loại sản phẩm");
        mnLoaiSanPham.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnLoaiSanPhamActionPerformed(evt);
            }
        });
        mnQuanLySanPham.add(mnLoaiSanPham);

        jMenuBar1.add(mnQuanLySanPham);

        mnQuanLyPhieuNhapHang.setText("Quản lý phiếu nhập hàng");
        mnQuanLyPhieuNhapHang.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyPhieuNhapHangMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyPhieuNhapHang);

        mnQuanLyHoaDon.setText("Quản lý hoá đơn");
        mnQuanLyHoaDon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyHoaDonMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyHoaDon);

        mnQuanLyPhieuThu.setText("Quản lý phiếu thu");
        mnQuanLyPhieuThu.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyPhieuThuMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyPhieuThu);

<<<<<<< .mine
        mnQuyDinh.setText("Quy định");
        mnQuyDinh.addMouseListener(new java.awt.event.MouseAdapter() {
=======
        mnThongKe.setText("Thống kê");

        mnThongKeDoanhThu.setText("Thống kê doanh thu");
        mnThongKeDoanhThu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnThongKeDoanhThuActionPerformed(evt);
            }
        });
        mnThongKe.add(mnThongKeDoanhThu);

        mnThongKeTon.setText("Thống kê tồn");
        mnThongKeTon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnThongKeTonActionPerformed(evt);
            }
        });
        mnThongKe.add(mnThongKeTon);

        mnThongKeHoaDon.setText("Thống kê hoá đơn");
        mnThongKeHoaDon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnThongKeHoaDonActionPerformed(evt);
            }
        });
        mnThongKe.add(mnThongKeHoaDon);

        mnThongKePhieuThu.setText("Thống kê phiếu thu");
        mnThongKePhieuThu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnThongKePhieuThuActionPerformed(evt);
            }
        });
        mnThongKe.add(mnThongKePhieuThu);

        jMenuBar1.add(mnThongKe);

        mnDangNhap.setText("Đăng nhập");
        mnDangNhap.addMouseListener(new java.awt.event.MouseAdapter() {
>>>>>>> .r122
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuyDinhMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuyDinh);

        mnQuyDinh.setText("Quy định");
        mnQuyDinh.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuyDinhMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuyDinh);

        mnThayDoiPassword.setText("Thay đổi Password");
        mnThayDoiPassword.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnThayDoiPasswordMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnThayDoiPassword);

        mnDangNhap.setText("Đăng nhập");
        mnDangNhap.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnDangNhapMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnDangNhap);

        mnDangXuat.setText("Đăng xuất");
        mnDangXuat.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnDangXuatMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnDangXuat);

        mnQuanLyKhachHang.setText("Quản lý khách hàng");
        mnQuanLyKhachHang.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnQuanLyKhachHangMouseClicked(evt);
            }
        });
        jMenuBar1.add(mnQuanLyKhachHang);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(stName, javax.swing.GroupLayout.DEFAULT_SIZE, 1120, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabMain, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(stName, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnQuanLyNhanVienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyNhanVienMouseClicked
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachNhanVienGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Quản lý nhân viên", new DanhSachNhanVienGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyNhanVienMouseClicked

    private void mnDangNhapMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnDangNhapMouseClicked
        // TODO add your handling code here:
        DangNhapGUI dangNhapGUI = new DangNhapGUI(this, true);
        final int x = (this.getWidth() - dangNhapGUI.getWidth()) / 2;
        final int y = (this.getHeight() - dangNhapGUI.getHeight()) / 2;
        dangNhapGUI.setLocation(x, y);
        dangNhapGUI.setVisible(true);
        SetStatusBar();
        SetMenu();
    }//GEN-LAST:event_mnDangNhapMouseClicked

    private void mnThayDoiPasswordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnThayDoiPasswordMouseClicked
        // TODO add your handling code here:
        ThayDoiPasswordGUI thayDoiPasswordGUI = new ThayDoiPasswordGUI(this, true);
        final int x = (this.getWidth() - thayDoiPasswordGUI.getWidth()) / 2;
        final int y = (this.getHeight() - thayDoiPasswordGUI.getHeight()) / 2;
        thayDoiPasswordGUI.setLocation(x, y);
        thayDoiPasswordGUI.setVisible(true);
    }//GEN-LAST:event_mnThayDoiPasswordMouseClicked

    private void mnDangXuatMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnDangXuatMouseClicked
        // TODO add your handling code here:
        if (JOptionPane.showConfirmDialog(this, "Bạn có chắc muốn đăng xuất không?", "Question", JOptionPane.YES_NO_OPTION) == 0) {
            nguoiDung = null;
            tabMain.removeAll();
            SetStatusBar();
            SetMenu();
        }
    }//GEN-LAST:event_mnDangXuatMouseClicked

    private void mnQuanLyHoaDonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyHoaDonMouseClicked
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachHoaDonGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Quản lý hoá đơn", new DanhSachHoaDonGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyHoaDonMouseClicked

    private void mnQuanLyPhieuThuMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyPhieuThuMouseClicked
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachPhieuThuGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Quản lý phiếu thu", new DanhSachPhieuThuGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyPhieuThuMouseClicked

<<<<<<< .mine
    private void mnQuyDinhMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuyDinhMouseClicked
        // TODO add your handling code here:
        try {
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof QuyDinhGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Quy định", new QuyDinhGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuyDinhMouseClicked

    private void mnQuanLyKhachHangMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyKhachHangMouseClicked
        // TODO add your handling code here:
        try {
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachKhachHangGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Quản lý khách hàng", new DanhSachKhachHangGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyKhachHangMouseClicked

=======
    private void mnThongKeDoanhThuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnThongKeDoanhThuActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof ThongKeDoanhThuGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Thống kê doanh thu", new ThongKeDoanhThuGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnThongKeDoanhThuActionPerformed

    private void mnQuyDinhMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuyDinhMouseClicked
        try {
            // TODO add your handling code here:
            QuyDinhGUI quyDinhGUI=new QuyDinhGUI(this, true);
            final int x = (this.getWidth() - quyDinhGUI.getWidth()) / 2;
            final int y = (this.getHeight() - quyDinhGUI.getHeight()) / 2;
            quyDinhGUI.setLocation(x, y);
            quyDinhGUI.setVisible(true);
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuyDinhMouseClicked

    private void mnQuanLyPhieuNhapHangMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyPhieuNhapHangMouseClicked
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachPhieuNhapHangGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách phiếu nhập hàng", new DanhSachPhieuNhapHangGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyPhieuNhapHangMouseClicked

    private void mnDanhSachSanPhamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnDanhSachSanPhamActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachSanPhamGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách sản phẩm", new DanhSachSanPhamGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnDanhSachSanPhamActionPerformed

    private void mnDanhSachSanPhamCuaHangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnDanhSachSanPhamCuaHangActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachSanPhamCuaHangGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách sản phẩm của cửa hàng", new DanhSachSanPhamCuaHangGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnDanhSachSanPhamCuaHangActionPerformed

    private void mnLoaiSanPhamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnLoaiSanPhamActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachLoaiSanPhamGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách loại sản phẩm", new DanhSachLoaiSanPhamGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnLoaiSanPhamActionPerformed

    private void mnQuanLyCuaHangMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyCuaHangMouseClicked
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachCuaHangGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách cửa hàng", new DanhSachCuaHangGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyCuaHangMouseClicked

    private void mnQuanLyKhachHangMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnQuanLyKhachHangMouseClicked
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof DanhSachKhachHangGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Danh sách khách hàng", new DanhSachKhachHangGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnQuanLyKhachHangMouseClicked

    private void mnThongKeTonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnThongKeTonActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof ThongKeTonGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Thống kê tồn", new ThongKeTonGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnThongKeTonActionPerformed

    private void mnThongKeHoaDonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnThongKeHoaDonActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof ThongKeHoaDonGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Thống kê hoá đơn", new ThongKeHoaDonGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnThongKeHoaDonActionPerformed

    private void mnThongKePhieuThuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnThongKePhieuThuActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            Component[] components = tabMain.getComponents();
            for (Component component : components) {
                if (component instanceof ThongKePhieuThuGUI) {
                    tabMain.setSelectedComponent(component);
                    return;
                }
            }
            tabMain.add("Thống kê phiếu thu", new ThongKePhieuThuGUI());
        } catch (Exception ex) {
            logger.error(new Date().toString(), ex);
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_mnThongKePhieuThuActionPerformed

>>>>>>> .r122
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new MainGUI().setVisible(true);
                } catch (UnsupportedLookAndFeelException ex) {
                    logger.error(new Date().toString(), ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JLabel lblName;
    private javax.swing.JMenu mnDangNhap;
    private javax.swing.JMenu mnDangXuat;
    private javax.swing.JMenuItem mnDanhSachSanPham;
    private javax.swing.JMenuItem mnDanhSachSanPhamCuaHang;
    private javax.swing.JMenuItem mnLoaiSanPham;
    private javax.swing.JMenu mnQuanLyCuaHang;
    private javax.swing.JMenu mnQuanLyHoaDon;
    private javax.swing.JMenu mnQuanLyKhachHang;
    private javax.swing.JMenu mnQuanLyNhanVien;
    private javax.swing.JMenu mnQuanLyPhieuNhapHang;
    private javax.swing.JMenu mnQuanLyPhieuThu;
<<<<<<< .mine
    private javax.swing.JMenu mnQuyDinh;
=======
    private javax.swing.JMenu mnQuanLySanPham;
    private javax.swing.JMenu mnQuyDinh;
>>>>>>> .r122
    private javax.swing.JMenu mnThayDoiPassword;
    private javax.swing.JMenu mnThongKe;
    private javax.swing.JMenuItem mnThongKeDoanhThu;
    private javax.swing.JMenuItem mnThongKeHoaDon;
    private javax.swing.JMenuItem mnThongKePhieuThu;
    private javax.swing.JMenuItem mnThongKeTon;
    private org.jdesktop.swingx.JXStatusBar stName;
    private org.xnap.commons.gui.CloseableTabbedPane tabMain;
    // End of variables declaration//GEN-END:variables
}
